<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <form action="" method="POST">
        请输入年份：<input type="text" name = "year"><br>
        亲输入月份：<input type="text" name = "mouth"><br>
        <input type="submit" value="提交">
    </form>
    <h1>
        <?php
           if(!empty($_POST['year']))
           {  
              $year = $_POST['year'];
              if(!empty($_POST['mouth']))
              { 
                $mouth = $_POST['mouth'];
                switch($mouth)
                {
                    case 1:
                    case 3:
                    case 5:
                    case 7:
                    case 8:
                    case 10:
                    case 12:
                        echo "{$year}年{$mouth}月天数为31天";      
                        break;
                    case 4:
                    case 6:
                    case 9:
                    case 11:
                        echo "{$year}年{$mouth}月天数为30天";
                        break;
                    case 2:
                        if($year%4==0&&$year%100!=0||$year%400==0)
                        {
                            echo "{$year}年{$mouth}月天数为29天";
                        }else
                        {
                            echo "{$year}年{$mouth}月天数为28天";
                        } 
                        break;
                    default:
                        echo "没有该月份";

                }
              }else
              {
                  echo "请输入月份";
              }
           }else
           {
               echo "请输入年份";
           }
        ?>
    </h1>
</body>
</html>